#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b){
    return a>b;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    int r[100100];
    cin>>n;
    int flag=1;
    for(int i=1;i<=n;i++){
        cin>>r[i];
        if(r[i]>2) flag=0;
    }
    if(flag==1){
        int sum1=0;
        int sum2=0;
        for(int i=1;i<=n;i++){
            if(r[i]==1) sum1++;
            if(r[i]==2) sum2++;
        }
        if(sum1>sum2) cout<<sum1;
        if(sum1<=sum2) cout<<sum2;
    }else{
        sort(r+1,r+n+1,cmp);
        //for(int i=1;i<=n;i++) cout<<r[i]<<" ";
        int alive[100010];
        memset(alive,0,sizeof(alive));
        int kill=0;
        /*for(int i=1;i<n;i++){
            int f=0;
            for(int j=i+1;j<=n;j++){
                if(r[i]>r[j]&&alive[j]==0&&alive[i]==0&&f==0){
                    alive[j]=1;
                    kill++;
                    f=1;
                }
            }
        }*/
        for(int i=n;i>1;i--){
            int f=0;
            for(int j=i-1;j>=1;j--){
                if(r[j]>r[i]&&f==0&&alive[i]==0&&alive[j]==0){
                    kill++;
                    alive[i]=1;
                    f=1;
                }
            }
        }
        cout<<n-kill<<endl;
    }
    return 0;
}
